package com.health.viewscontrols.lvyuejl;

import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.health.R;
import com.health.model.LvYueFuWuBean;
import com.health.tools.ImageTools;
import com.health.viewscontrols.NovaActivity;


/**
 * 展示履约服务
 * Created by John on 2019/3/5.
 */

public class ShowLvYueActivity1 extends NovaActivity {
    Button btn_back;//返回
    TextView title;//标题


    TextView ed_date;//服务时间
    TextView lvyue_name;//姓名
    TextView lvYue_age;//年龄

    TextView lvyueHight;//身高
    TextView lvyueWeight;//体重

    TextView lvyueTzzs;//体质指数
    TextView lvyueHuxi;//呼吸频率
    TextView lvyueXinlv;//心率
    TextView lvyueTiwen;//体温
    TextView lvyueXueYaGao;//收缩压
    TextView lvyueXueYaDi;//舒张压
    TextView lvyueXueTang;//血糖
    TextView xuetang_spinner;
    TextView lvyueJkgl;//健康管理
    TextView lvyueZyqk;//住院情况
    TextView lvyueZzqk;//转诊情况
    TextView lvyuedocName;//医生姓名
    ImageView lvyueDocImg;

    TextView lvyueHuanName;//患者姓名
    ImageView lvyueHuanImg;

    TextView lvyueBeiZhu;//备注
    LvYueFuWuBean lvYueFuWuBean;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_lvyue1);
        lvYueFuWuBean=(LvYueFuWuBean) getIntent().getSerializableExtra("LvYueBean");
        findViews();
        setData();
        setListeners();

    }

    @Override
    public void findViews() {
        btn_back=findViewById(R.id.btn_back);
        title=findViewById(R.id.title);
        title.setText("履约服务记录表");

        ed_date=findViewById(R.id.ed_date);
        lvyue_name=findViewById(R.id.lvyue_name);
        lvYue_age=findViewById(R.id.lvyue_age);

        lvyueHight=findViewById(R.id.lvyue_hight);
        lvyueWeight=findViewById(R.id.lvyue_weight);
        lvyueTzzs=findViewById(R.id.lvyue_tzzs);
        lvyueHuxi=findViewById(R.id.lvyue_huxi);
        lvyueXinlv=findViewById(R.id.lvyue_xinlv);

        lvyueTiwen=findViewById(R.id.lvyue_tiwen);
        lvyueXueYaGao=findViewById(R.id.lvyue_xueya_gao);
        lvyueXueYaDi=findViewById(R.id.lvyue_xueya_di);
        lvyueXueTang=findViewById(R.id.lvyue_xuetang);
        xuetang_spinner=findViewById(R.id.xuetang_spinner);
        lvyueJkgl=findViewById(R.id.lvyue_jkgl);
        lvyueZyqk=findViewById(R.id.lvyue_zyqk);
        lvyueZzqk=findViewById(R.id.lvyue_zzqk);
        lvyuedocName=findViewById(R.id.lvyue_docname);
        lvyueDocImg=findViewById(R.id.img_doctorsign);
        lvyueHuanName=findViewById(R.id.lvyue_juming_name);
        lvyueHuanImg=findViewById(R.id.img_patientsign);
        lvyueBeiZhu=findViewById(R.id.lvyue_beizhu);
    }

    public void setData(){
        if(lvYueFuWuBean!=null){
            ed_date.setText(lvYueFuWuBean.getLvyueDate());
            lvyue_name.setText(lvYueFuWuBean.getName());
            lvYue_age.setText(lvYueFuWuBean.getAge());
            lvyueHight.setText(lvYueFuWuBean.getHight());
            lvyueWeight.setText(lvYueFuWuBean.getWeight());
            lvyueTzzs.setText(lvYueFuWuBean.getTzzs());
            lvyueHuxi.setText(lvYueFuWuBean.getHuxi());
            lvyueXinlv.setText(lvYueFuWuBean.getXinlv());
            lvyueTiwen.setText(lvYueFuWuBean.getTiWen());
            lvyueXueYaGao.setText(lvYueFuWuBean.getXueyaGao());
            lvyueXueYaDi.setText(lvYueFuWuBean.getXueyaDi());
            lvyueXueTang.setText(lvYueFuWuBean.getXueTang());
            lvyueJkgl.setText(lvYueFuWuBean.getJkgl());
            lvyueZyqk.setText(lvYueFuWuBean.getZyqk());
            lvyueZzqk.setText(lvYueFuWuBean.getZzqk());
            lvyuedocName.setText(lvYueFuWuBean.getDocName());
            lvyueHuanName.setText(lvYueFuWuBean.getName());
            lvyueDocImg.setBackground(new BitmapDrawable(null, ImageTools.readBitmapAutoSize(lvYueFuWuBean.getDocQianMingStr())));
            lvyueHuanImg.setBackground(new BitmapDrawable(null, ImageTools.readBitmapAutoSize(lvYueFuWuBean.getHuanQianMingStr())));
            lvyueBeiZhu.setText(lvYueFuWuBean.getBeiZhu());
            if("1".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("空腹血糖");
            }else if("2".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("餐后1小时血糖");
            }else if("3".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("餐后2小时血糖");
            }else if("4".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("随机血糖");
            }
        }

    }

    @Override
    public void setListeners() {
        btn_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
